package com.stylefeng.guns.modular.system.warpper;

import java.text.DecimalFormat;
import java.util.List;
import java.util.Map;

import com.stylefeng.guns.core.base.warpper.BaseControllerWarpper;
import com.stylefeng.guns.core.common.constant.factory.ConstantFactory;
import com.stylefeng.guns.modular.system.model.Gdhs;
import com.stylefeng.guns.modular.system.model.Gdprice;
import com.stylefeng.guns.modular.system.model.Gpdata;

public class AllRealTimeMonitorWarpper extends BaseControllerWarpper{
	
	public AllRealTimeMonitorWarpper(List<Map<String, Object>> list) {
        super(list);
    }

    @Override
    public void warpTheMap(Map<String, Object> map) {
    	String gScode = (String)map.get("gScode");
    	Gdhs gdhs =  ConstantFactory.me().getGdhs(gScode);
		Gdprice gdprice =  ConstantFactory.me().getGdprice(gScode);
		Gpdata gpdata = ConstantFactory.me().getGpdata(gScode);
		if(gdhs == null || gdprice == null || gpdata == null) return;
		
    	String gJgcydType = gpdata.getgJgcydType();
		String font = "";
		if(gJgcydType.equals("不控盘")){
			font = "<font color='DimGray'><b>不控盘</b></font>";
		}else if(gJgcydType.equals("轻度控盘")){
			font = "<font color='BurlyWood'><b>轻度控盘</b></font>";
		}else if(gJgcydType.equals("中度控盘")){
			font = "<font color='Chocolate'><b>中度控盘</b></font>";
		}else{
			font = "<font color='Brown'><b>完全控盘</b></font>";
		}
		map.put("gJgcydType", font);
		map.put("gOwerBk", gpdata.getgOwerBk());
		DecimalFormat df = new DecimalFormat("0.00");
		map.put("gZsz", df.format(Math.abs((gdhs.getgZsz() / 100000000))));
		
		Long gType = (Long)map.get("gType");
		if(gType == 8193l){
    		map.put("gType", "<font color='red'><b>大笔买入</font></b>");
    		map.put("gDec", "<font color='red'><b>大笔买入"+map.get("gDec")+"</font></b>");
    	}else if(gType == 8194l){
    		map.put("gType", "<font color='green'><b>大笔卖出</font></b>");
    		map.put("gDec", "<font color='green'><b>大笔卖出"+map.get("gDec")+"</font></b>");
    	}
    }
}
